const webpack = require('webpack')

const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const common = require('./webpack.common.js');

module.exports = merge(common, {
    devtool: 'source-map', //对调试源码(debug)和运行基准测试(benchmark tests)很有帮助
    plugins: [
        new UglifyJSPlugin({
           sourceMap: true
        }),
        new webpack.DefinePlugin({
            //指定环境，一些 lib 可能会对 production 的环境进行代码优化
            'process.env.NODE_ENV': JSON.stringify('production')
        })
    ]
});